Overview

The Dundas BI engine provides methods for accessing core application functionality. The engine can be started, stopped, and provides a means of getting the different Dundas BI service interfaces. This page outlines creating and starting the Dundas BI Engine, then logging on as a specific user account using the logon service.

Create the Engine

In order to create the Dundas BI Engine, you need to create a CreateEngineOptions object with at least the following property set:

Optionally, the following other options can be set when creating an engine:

using Dundas.BI;
using Dundas.BI.Services;
   ...

// Create the CreateEngineOptions object.
CreateEngineOptions createEngineOptions = new CreateEngineOptions();
// Path to the application's data folder. Type: System.String
createEngineOptions.AppDataPath = appDataPath;

// Create the Engine.
EngineManager.CreateEngine(createEngineOptions);
    

Start the Engine

To start the engine, use the StartEngine method on the EngineManager class.

using Dundas.BI;
using Dundas.BI.Services;
   ...

EngineManager.StartEngine();
    

Logon

After starting the engine, it is necessary to set the current caller context. Specify the session ID as null if there is no current session such as when first logging on. After logging on, set the current session ID obtained from the LogOnResult object.

using Dundas.BI;
using Dundas.BI.Services;
   ...

using(Engine.Current.GetService<ICallerContextService>().CreateAndSetCurrentContext(null))
{
		
    LogOnResult logOnResult = Engine.Current.GetService<ILogOnService>().LogOn(
	    "admin",
	    "1234",
	    true,
	    null
    );
		
    Engine.Current.GetService<ICallerContextService>().CurrentContext.SetCurrentSessionId(logOnResult.Session.Id);

}
    

Example

The following complete example creates and starts the Dundas BI Engine, logs on, then sets the current session ID to be used in any subsequent service calls:

using Dundas.BI;
using Dundas.BI.Services;
   ...

 // Create the CreateEngineOptions object.
CreateEngineOptions createEngineOptions = new CreateEngineOptions();
// Path to the application's data folder. Type: System.String
createEngineOptions.AppDataPath = appDataPath;
// Create the Engine.
EngineManager.CreateEngine(createEngineOptions);
EngineManager.StartEngine();
 
using(Engine.Current.GetService<ICallerContextService>().CreateAndSetCurrentContext(null))
{
 
    LogOnResult logOnResult = Engine.Current.GetService<ILogOnService>().LogOn(
        // The account name. Type: System.String
        accountName,
        // The password. Type: System.String
        password,
        // Delete other sessions for the logon to succeed. Type: System.Boolean
        deleteOtherSessions,
        // Culture to associate with the session, or null. Type: System.Globalization.CultureInfo
        explicitCulture
    );
 
    Engine.Current.GetService<ICallerContextService>().CurrentContext.SetCurrentSessionId(logOnResult.Session.Id);


}